﻿<!DOCTYPE html>
<html ng-app="demoApp">
<head>
    <title id="Description">Using AngularJS ng-model combined with jqx-ng-model</title>
    <link rel="stylesheet" type="text/css" href="../../jqwidgets/styles/jqx.base.css" />
    <script type="text/javascript" src="../../scripts/angular.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxinput.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcalendar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxradiobutton.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdatetimeinput.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxnumberinput.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/globalization/globalize.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxangular.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);

        demoApp.controller("demoController", function ($scope) {
            $scope.user = {
                birthDateAsText: "1985-10-01",
                birthDateAsJavaScriptDate: new Date(1985, 9, 1),
                friends:
                [
                    'Brian',
                    'Peter',
                    'George'
                ],
                family:
                [
                    { name: "Jane", age: 45,type:  "mother" },
                    { name: "Robert", age: 46, type: "father" },
                    { name: "Martin", age: 35, type: "brother" }
                ],
                selectedFriend: 'Brian',
                selectedFamilyMember: { name: "Jane", age: 45, type: "mother" }
            };
        });
    </script>
</head>
<body>
    <div ng-controller="demoController">
        <form name="userForm">
            <jqx-date-time-input jqx-width="200" jqx-height="25" ng-model="user.birthDateAsText"></jqx-date-time-input>
            <br />
            <jqx-date-time-input jqx-width="200" jqx-height="25" jqx-ng-model ng-model="user.birthDateAsJavaScriptDate"></jqx-date-time-input>
            <br />
            <jqx-list-box ng-model="user.selectedFriend" jqx-width="200" jqx-height="80" jqx-source="user.friends"></jqx-list-box>
            <br />
            <jqx-list-box jqx-ng-model ng-model="user.selectedFamilyMember" jqx-width="200" jqx-height="80" jqx-source="user.family" jqx-display-member="'name'" jqx-value-member="'type'"></jqx-list-box>
        </form>
        <label>value (as a string) without jqx-ng-model</label>
        <pre>user.birthDateAsText = <span ng-bind="user.birthDateAsText"></span></pre>
        <label>value (as a JavaScript Date object) with jqx-ng-model</label>
        <pre>user.birthDateAsJavaScriptDate = <span ng-bind="user.birthDateAsJavaScriptDate"></span></pre>
        <label>value (as a string) without jqx-ng-model</label>
        <pre>user.selectedFriend = <span ng-bind="user.selectedFriend"></span></pre>
        <label>value (as an Object) with jqx-ng-model</label>
        <pre>user.selectedFamilyMember = <span ng-bind="user.selectedFamilyMember.name"></span>, <span ng-bind="user.selectedFamilyMember.type"></span>, <span ng-bind="user.selectedFamilyMember.age"></span></pre>
    </div>
</body>
</html>
